package com.aptg;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class GiftData {

	public static void main(String[] args) throws IOException {
		try {
			String sql = null;
			
			File file = new File("E://eshop_oes_data//gift_data.txt");
			BufferedReader brdFile = new BufferedReader(new FileReader(file));
			String strLine = null;

			File outFile = new File("E://eshop_oes_data//gift_data.sql");
			BufferedWriter writer = new BufferedWriter(new FileWriter(outFile));
			
			while ((strLine = brdFile.readLine()) != null) {
				String[] data = strLine.split(",");

				sql = "";
				sql += "insert into apt_gift_data (gift_code, gift_name, gift_model, gift_provider, remark, product_type, mobile_type, platform_id, mobile_sub_type, update_time)";
				sql += " values ('" + data[0] + "','" + data[1] + "','" + data[2] + "','" + data[3] + "','" + data[4] + "','" + data[5] + "','" + data[6] + "','" + data[7] + "','" + data[8] + "','2011-01-18 03:23:06')";
				sql += ";\r\n";
				
				writer.write(sql);
			}
			
			brdFile.close();
			writer.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
